import ScoreScript from "./ScoreScript";

const { ccclass, property } = cc._decorator;

@ccclass
export default class BirdControl extends cc.Component {

	@property(ScoreScript)
	score: ScoreScript = null

	onLoad() {
		// 物理引擎开启
		cc.director.getPhysicsManager().enabled = true
	}

	start() {

	}

	// 飞
	fly() {
		this.getComponent(cc.RigidBody).linearVelocity = cc.v2(0, 150)
	}

	update(dt) { }

	onBeginContact(contact, self, other) {
		if (other.tag == 1) {
			console.log("加分")
			this.score.addScore()
		} else {
			console.log("死亡")
		}
	}
}
